<?php
require_once '../core/db_abstract_model.php';


class Personal extends db_abstract_model{
    
    public   $nIdPersonal;
    public   $sNombre;
    private  $sPaterno;
    private  $sMaterno;
    private  $nCargo;
    private  $bActivo;
    private  $dFecha;
    private  $sUsuario;
    private  $sTerminal;

    public function get($nIdPersonal='') {
       if (!$nIdArticulo==''){
           $this->query="SELECT * from SCICPersonal WHERE nIdPersonal = $nIdPersonal";
           $this->get_queryresults();
           if (count($this->result_rows)==1)
               {
                foreach ($this->result_rows[0] as $propiedad=>$valor)
                    {
                        $this->$propiedad=$valor;
                    }
                    $this->getimages();
               }
           else{
                    $this->msj=MSJ_ITEM_FOUND;
               }
        
           }
           else{
               $this->msj=MSJ_ITEM_UNFOUND;
           }
    }
   
    public function set($depto_data=array()) {
 
   }
    
    public function edit($depto_data=array()) {
      
    }
    
    public function delete($nIdDepartamento=''){

    }
    
    public function getpersonal($param=''){
        $this->query="SELECT nIdPersonal,CONCAT_WS(' ',sNombre,sPaterno,sMaterno) from SCICPersonal";
        if($param!='')
        $this->query="SELECT nIdPersonal,CONCAT_WS(' ',sNombre,sPaterno,sMaterno) from SCICPersonal Where nIdPersonal=$param
                      UNION ALL
                      SELECT nIdPersonal,CONCAT_WS(' ',sNombre,sPaterno,sMaterno) from SCICPersonal Where nIdPersonal!=$param
                     ";

        $this->get_numqueryresults();
        $resultset=array();
        if (count($this->result_rows)>=1){
            $resultset=$this->result_rows;
        }
        else{
            $this->msj=MSJ_NODEPTO_RESULTS;
        }
        return $resultset;
    }
    
    function __construct() {
        $this->db_name='DBSCInterno';
    }
    
    function __destruct() {
        unset($this);
    }
}
?>
